import { getAreaEnergyConsumptionTable, getCompanyEnergyConsumptionTable } from '@/api/energyConsumption';

export default {
  data() {
    return {
      tableData: {},
    };
  },
  computed: {
    energyType() {
      return this.$store.state.energyType;
    },
  },
  methods: {
    async getTableData() {
      try {
        const { data } = await getAreaEnergyConsumptionTable(this.getParams());
        this.tableData = data;
      } catch (e) {
        console.log(e);
      }
    },
    async loadTableMore (tree, treeNode) {
      const areaCode = tree.districtCode;
      const params = this.getParams();
      return getCompanyEnergyConsumptionTable(areaCode, params);
    },
    handleChangeCheckbox (checked) {
      this.getTableData();
    }
  }
};
